//
//  XingCeConst.swift
//  XingCeHelper
//
//  Created by 申铭 on 2022/7/29.
//

import UIKit

// MARK: -

/// 2022-08-31
let kBaseTimestamp: TimeInterval = 1661875200


// MARK: - UI

let kScreenWidth = UIScreen.main.bounds.width
let kScreenHeight = UIScreen.main.bounds.height


let kTableViewCellHeight: CGFloat = 50
/// 导航栏高度
let kNavigationH:CGFloat = FNavigationHeight()
let kTopicFontSize: CGFloat = 35
/// 算数题目字体
let kTopicFont = UIFont.systemFont(ofSize: kTopicFontSize)

let kNavBarBtnFont = UIFont.systemFont(ofSize: 16)



// MARK: - UserDefaults

/// 亮度开关
let kUserDefaults_BrightnessSwitch: String = "brightnessSwitch"
/// 亮度值
let kUserDefaults_BrightnessValue: String = "brightnessValue"

/// 练习模式
let kUserDefaults_ReciteMode: String = "reciteMode"

// MARK: - func

func FCurrentNav() -> UINavigationController? {
    return UIViewController.currentNavController()
}

func FIsLiuhaiScreen() -> Bool {
    if #available(iOS 11, *) {
        guard let w = UIApplication.shared.delegate?.window, let unwrapedWindow = w else {
            return false
        }
        
        if unwrapedWindow.safeAreaInsets.left > 0 || unwrapedWindow.safeAreaInsets.bottom > 0 {
            return true
        }
    }
    return false
}

/// 导航栏的高度
func FNavigationHeight() -> CGFloat {
    return FIsLiuhaiScreen() ? (FGetStatusBarHeight() + 44) : 64
}

/// 获取状态栏高度
func FGetStatusBarHeight() -> CGFloat {
    if #available(iOS 13.0, *) {
        return UIApplication.shared.windows.first?.windowScene?.statusBarManager?.statusBarFrame.size.height ?? 47
    } else {
        return UIApplication.shared.statusBarFrame.size.height
    }
}
